package com.dinadi.yidi.http;

import com.zhy.http.okhttp.callback.StringCallback;

import okhttp3.Call;

/**
 * Created by dell on 2016/3/21.
 */
public abstract class MyHttpCallback extends StringCallback {

    /**
     * 外部调用此方法进行数据处理
     *
     * @param response
     */
    public abstract void onSuccess(String response);

    public abstract void onFailure(String error);

    @Override
    public void onResponse(String response) {
        //公用返回数据处理
        onSuccess(response);
    }

    @Override
    public void onError(Call call, Exception e) {
        onFailure(e.getMessage());
    }
}
